//
//  UUCarManager.h
//  UUCharterSupplier
//
//  Created by ZhangAo on 22/01/2018.
//  Copyright © 2018 UUCharter. All rights reserved.
//

#import <UUFoundation/DKBaseManager.h>
#import "UUCarModel.h"

@protocol UUCarManagerObserver

- (void)carManagerDidUpdateCars;

@optional

// 车辆更新成功
- (void)carManagerDidDeleteCars:(NSArray<NSNumber *> *)cars;

@end

#define GetCarManager()         ([UUCarManager sharedInstance])

@interface UUCarManager : DKBaseManager

// 增量更新，将同时更新车辆和车辆类型
- (void)asyncUpdateCars;

// 获取指定状态的车辆
- (NSArray<NSNumber *> *)fetchCarsForStatus:(UUCarReviewStatus)status;

// 获取指定状态、指定车型的车辆
- (NSArray<NSNumber *> *)fetchCarsForStatus:(UUCarReviewStatus)status greaterThanOrEqualToCarCategory:(NSNumber *)carCategory;

// 获取指定状态、指定车型、指定车队的车辆
- (NSArray<NSNumber *> *)fetchCarsForStatus:(UUCarReviewStatus)status greaterThanOrEqualToCarCategory:(NSNumber *)carCategory fleetId:(NSNumber *)fleetId;

- (UUCarModel *)fetchCarWithCarId:(id)carId;

// 删除车辆
- (void)asyncDeleteCarWithCarId:(NSNumber *)carId completeBlock:(void (^)(NSError *error))completeBlock;

// 添加车辆
- (void)addCarWithFleetId:(NSNumber *)fleetId
                   carNum:(NSString *)carNum
                  carType:(NSNumber *)carType
                   isSelf:(BOOL)isSelf
           vehicleLicense:(NSString *)vehicleLicense
     vehicleLicenseDeputy:(NSString *)vehicleLicenseDeputy
                insurance:(NSString *)insurance
         transportLicense:(NSString *)transportLicense
            completeBlock:(void (^)(NSError *error))completeBlock;

// 更新车辆
- (void)updateCarWithCarId:(NSNumber *)carId
                   fleetId:(NSNumber *)fleetId
                    carNum:(NSString *)carNum
                   carType:(NSNumber *)carType
                    isSelf:(BOOL)isSelf
            vehicleLicense:(NSString *)vehicleLicense
      vehicleLicenseDeputy:(NSString *)vehicleLicenseDeputy
                 insurance:(NSString *)insurance
          transportLicense:(NSString *)transportLicense
             completeBlock:(void (^)(NSError *error))completeBlock;

@end
